package com.dtx.day5.day05Demo;

import com.dtx.day1.entity.Goods;
import com.dtx.day1.service.GoodsService;
import com.dtx.factory.AnnotationBeanFactory;
import org.junit.Test;

public class T {

    @Test
    public void test() throws Exception {
        GoodsService service = AnnotationBeanFactory.getBean("GoodsServiceImpl", GoodsService.class);
        //GoodsService goodsService = AnnotationBeanFactory.getBean(GoodsService.class);
        GoodsService goodsService = AnnotationBeanFactory.getBean("GoodsService",GoodsService.class);
        Goods goods = AnnotationBeanFactory.getBean("Goods", Goods.class);
        System.out.println(goods);
        System.out.println(goodsService);
        System.out.println(service);
    }

    @Test
    public void test1() throws Exception {
        GoodsService service = AnnotationBeanFactory.getBean(GoodsService.class);
        System.out.println(service.findGoods());
        System.out.println(service.addGoods(new Goods()));
    }
}
